﻿@using DualControl.CommonServices
@using DualControl.RiskLibrary.Dtos

@model Abp.Application.Services.Dto.ListResultDto<HSNotificationListDto>
@using X.PagedList.Mvc.Core; @*import this so we get our HTML Helper*@
@using X.PagedList; @*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@

@inject ICommonService CommonService

@section scripts
    {
    <environment names="Development">
        <script src="~/view-resources/Views/ControlMeasures/Index.js" asp-append-version="true"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/view-resources/Views/ControlMeasures/Index.min.js" asp-append-version="true"></script>
    </environment>
}
<style>
    .table tbody tr th td {
        vertical-align: middle;
    }
</style>

<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="card">
            <div class="header">
                <h2>
                    @L("ControlMeasure")
                </h2>
                <ul class="header-dropdown m-r--5">
                    <li class="dropdown">
                        <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            <i class="material-icons">more_vert</i>
                        </a>
                        <ul class="dropdown-menu pull-right">
                            <li><a id="RefreshButton" href="javascript:void(0);" class="waves-effect waves-block"><i class="material-icons">refresh</i>@L("Refresh")</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="body table-responsive">



                @foreach (var hazardsource in ViewBag.PageOfHSControlMeasureListDto)
                {

                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center ">
                            @hazardsource.HazardSourceName &nbsp;风险点告知卡
                        </h3>
                    </div>
                    <div class="panel-body">
                        <h4 class="panel-title">
                            单位名称：@CommonService.GetOrganizationUnits().SingleOrDefault(c => c.Key == @hazardsource.OrganizationUnitId).Value
                        </h4>
                    </div>
                    <table class="table">
                        <tr>
                            <td width="20%">危险源名称：</td>
                            <td width="20%">@hazardsource.HazardSourceName</td>
                            <td width="30%" rowspan="3"  valign="middle">风险因素</td>
                            <td rowspan="3" valign="middle">@hazardsource.RiskFactor</td>
                        </tr>
                        <tr>
                            <td>风险点编号</td>
                            <td>@hazardsource.Code</td>
                        </tr>
                        <tr>
                            <td>风险等级</td>
                            <td>@hazardsource.RiskLevel</td>
                        </tr>

                        <tr>
                            <td align="center" colspan="2">
                                安全标志<br />
                                @{
                                    foreach (var img in @hazardsource.AccidentTypesForView)
                                    {
                                        <img src="~/images/safetysigns/@{@img;}.jpg" width="80" />
                                    }
                                }

                            </td>


                            <td>控制措施</td>
                            <td>
                                @{ if (hazardsource.ControlMeasures.Count > 0)
                                    {

                                        @foreach (var controlmeasure in hazardsource.ControlMeasures)
                                        {

                                            @controlmeasure.ControlContent <br />

                                        }
                                    }
                                }
                            </td>
                        </tr>
                        <tr>
                            <td>责任部门</td>
                            <td></td>
                            <td>主要事故类型</td>
                            <td>
                                @{
                                    string space = " ";
                                    foreach (var accidenttype in @hazardsource.AccidentTypesForView)
                                    {
                                        @accidenttype @space
                                    }
                                }

                            </td>
                        </tr>
                        <tr>
                            <td>责任人 联系电话</td>
                            <td></td>
                            <td>应急处置措施</td>
                            <td>
                                @{ if (hazardsource.EmergencyMeasures.Count > 0)
                                    {

                                        @foreach (var controlmeasure in hazardsource.EmergencyMeasures)
                                        {

                                            @controlmeasure.EmergencyMeasuresContent <br />

                                        }
                                    }
                                }

                            </td>
                        </tr>



                    </table>

                    </div>
                    }
                </div>
        </div>
    </div>
</div>


              


@Html.PagedListPager((IPagedList)ViewBag.PageOfHSControlMeasureListDto, page => Url.Action("Index", new { page }))